package com.baidu.mobstat;

import android.app.Activity;
import android.content.Context;

public class StatService
{
  public static final int EXCEPTION_LOG = 1;
  private static boolean a = false;

  private static void a(Context paramContext)
  {
    if (!a(paramContext, "onError(...)"))
      return;
    e.a().a(paramContext.getApplicationContext());
    g.a().a(true, paramContext.getApplicationContext());
  }

  private static boolean a()
  {
    return a;
  }

  private static boolean a(Context paramContext, String paramString)
  {
    if (paramContext == null)
    {
      Object[] arrayOfObject = new Object[2];
      arrayOfObject[0] = "stat";
      arrayOfObject[1] = (paramString + ":context=null");
      com.baidu.mobstat.a.b.b(arrayOfObject);
      return false;
    }
    return true;
  }

  private static boolean a(Class<?> paramClass, String paramString)
  {
    int i = 2;
    StackTraceElement[] arrayOfStackTraceElement = new Throwable().getStackTrace();
    Object[] arrayOfObject1 = new Object[4];
    arrayOfObject1[0] = "isCalledBy";
    arrayOfObject1[1] = Integer.valueOf(arrayOfStackTraceElement.length);
    arrayOfObject1[i] = paramClass;
    arrayOfObject1[3] = paramString;
    com.baidu.mobstat.a.b.a(arrayOfObject1);
    if ((arrayOfStackTraceElement.length >= i) && (i < arrayOfStackTraceElement.length))
    {
      label56: StackTraceElement localStackTraceElement = arrayOfStackTraceElement[i];
      if (localStackTraceElement.getMethodName().equals(paramString));
      Class localClass;
      do
      {
        try
        {
          localClass = Class.forName(localStackTraceElement.getClassName());
          com.baidu.mobstat.a.b.a(new Object[] { "isCalledBy", localClass });
          if ((localClass.getSuperclass() == null) || (localClass.getSuperclass() == paramClass))
            break label166;
          localClass = localClass.getSuperclass();
          com.baidu.mobstat.a.b.a(new Object[] { "isCalledBy", localClass });
        }
        catch (Exception localException)
        {
          com.baidu.mobstat.a.b.a(localException);
          ++i;
        }
        label166: break label56:
      }
      while (localClass.getSuperclass() != paramClass);
      Object[] arrayOfObject2 = new Object[3];
      arrayOfObject2[0] = "isCalledBy hit!";
      arrayOfObject2[1] = localClass.getSuperclass();
      arrayOfObject2[2] = paramClass;
      com.baidu.mobstat.a.b.a(arrayOfObject2);
      return true;
    }
    return false;
  }

  private static void b()
  {
    a = true;
  }

  public static void onEvent(Context paramContext, String paramString1, String paramString2)
  {
    onEvent(paramContext, paramString1, paramString2, 1);
  }

  public static void onEvent(Context paramContext, String paramString1, String paramString2, int paramInt)
  {
    if (!a(paramContext, "onEvent(...)"));
    do
      return;
    while ((paramString1 == null) || (paramString1.equals("")));
    if (!f.a().b())
      f.a().a(paramContext.getApplicationContext());
    c.a().a(paramContext.getApplicationContext(), paramString1, paramString2, paramInt);
  }

  public static void onPause(Context paramContext)
  {
    monitorenter;
    while (true)
    {
      try
      {
        boolean bool = a(paramContext, "onPause(...)");
        if (!bool)
          return;
        throw new SecurityException("onPause(Context context)不在Activity.onPause()中被调用||onPause(Context context)is not called in Activity.onPause().");
      }
      finally
      {
        monitorexit;
      }
      m.a().b(paramContext, System.currentTimeMillis());
    }
  }

  public static void onResume(Context paramContext)
  {
    monitorenter;
    while (true)
    {
      try
      {
        boolean bool = a(paramContext, "onResume(...)");
        if (!bool)
          return;
        throw new SecurityException("onResume(Context context)不在Activity.onResume()中被调用||onResume(Context context)is not called in Activity.onResume().");
      }
      finally
      {
        monitorexit;
      }
      if (!f.a().b())
        f.a().a(paramContext.getApplicationContext());
      m.a().a(paramContext, System.currentTimeMillis());
    }
  }

  public static void setAppChannel(String paramString)
  {
    b.a().b(paramString);
  }

  public static void setAppKey(String paramString)
  {
    b.a().a(paramString);
  }

  public static void setLogSenderDelayed(int paramInt)
  {
    g.a().a(paramInt);
  }

  public static void setOn(Context paramContext, int paramInt)
  {
    if (!a(paramContext, "setOn(...)"));
    do
    {
      do
      {
        return;
        if (a(Activity.class, "onCreate"))
          continue;
        throw new SecurityException("setOn()没有在Activity.onCreate()内被调用||setOn()is not called in Activity.onCreate().");
      }
      while (a());
      b();
    }
    while ((paramInt & 0x1) == 0);
    a(paramContext);
  }

  public static void setSendLogStrategy(Context paramContext, SendStrategyEnum paramSendStrategyEnum, int paramInt)
  {
    setSendLogStrategy(paramContext, paramSendStrategyEnum, paramInt, false);
  }

  public static void setSendLogStrategy(Context paramContext, SendStrategyEnum paramSendStrategyEnum, int paramInt, boolean paramBoolean)
  {
    if (!a(paramContext, "setSendLogStrategy(...)"))
      return;
    if (!f.a().b())
      f.a().a(paramContext.getApplicationContext());
    g.a().a(paramContext.getApplicationContext(), paramSendStrategyEnum, paramInt, paramBoolean);
  }
}

/* Location:           C:\Users\god\Desktop\liunianjishiben_V1.1_mumayi_3745b_dex2jar.jar
 * Qualified Name:     com.baidu.mobstat.StatService
 * JD-Core Version:    0.5.4
 */